home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / patch_2_0_12g8.lha / patch-2.0.12g8 / configure < prev    next >
Text File  |  1992-09-15  |  14KB  |  582 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec_prefix=PREFIX] [--with-PROGRAM] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec_prefix, and --no-create.
  23.  
  24. trap 'rm -f conftest* core; exit 1' 1 3 15
  25.  
  26. for arg
  27. do
  28.   # Handle --exec_prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=*)
  39.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  40.      -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e)
  41.     next_exec_prefix=yes ;;
  42.  
  43.      -gas | --gas | --ga | --g) ;;
  44.  
  45.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  46.      -host | --host | --hos | --ho | --h)
  47.     next_host=yes ;;
  48.  
  49.      -nfp | --nfp | --nf) ;;
  50.  
  51.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  52.         no_create=1 ;;
  53.  
  54.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  55.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  56.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  57.     next_prefix=yes ;;
  58.  
  59.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  60.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  61.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  62.     next_srcdir=yes ;;
  63.  
  64.      -with-* | --with-*) ;;
  65.  
  66.      *) ;;
  67.     esac
  68.   fi
  69. done
  70.  
  71. rm -f conftest*
  72. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  73.  
  74. # A filename unique to this package, relative to the directory that
  75. # configure is in, which we can look for to find out if srcdir is correct.
  76. unique_file=patch.c
  77.  
  78. # Find the source files, if location was not specified.
  79. if test -z "$srcdir"; then
  80.   srcdirdefaulted=yes
  81.   # Try the directory containing this script, then `..'.
  82.   prog=$0
  83.   confdir=`echo $prog|sed 's,/[^/][^/]*$,,'`
  84.   test "X$confdir" = "X$prog" && confdir=.
  85.   srcdir=$confdir
  86.   if test ! -r $srcdir/$unique_file; then
  87.     srcdir=..
  88.   fi
  89. fi
  90. if test ! -r $srcdir/$unique_file; then
  91.   if test x$srcdirdefaulted = xyes; then
  92.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  93.   else
  94.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  95.   fi
  96.   exit 1
  97. fi
  98. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  99. # But we can't avoid them for `..', to make subdirectories work.
  100. case $srcdir in
  101.   .|/*|~*) ;;
  102.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  103. esac
  104.  
  105.  
  106. compile='rm -f conftest.t;
  107.   mv conftest.c conftest.t;
  108.   echo "$DEFS" > conftest.c;
  109.   cat conftest.t >> conftest.c;
  110.   rm -f conftest.t;
  111.   ${CC-cc} conftest.c -o conftest $LIBS >/dev/null 2>&1'
  112.  
  113. if test -z "$CC"; then
  114.   echo checking for gcc
  115.   saveifs="$IFS"; IFS="${IFS}:"
  116.   for dir in $PATH; do
  117.     test -z "$dir" && dir=.
  118.     if test -f $dir/gcc; then
  119.       CC="gcc"
  120.       break
  121.     fi
  122.   done
  123.   IFS="$saveifs"
  124. fi
  125. test -z "$CC" && CC="cc"
  126.  
  127. # Find out if we are using GNU C, under whatever name.
  128. cat <<EOF > conftest.c
  129. #ifdef __GNUC__
  130.   yes
  131. #endif
  132. EOF
  133. ${CC-cc} -E conftest.c > conftest.out 2>&1
  134. if egrep yes conftest.out >/dev/null 2>&1; then
  135.   GCC=1 # For later tests.
  136.   CC="$CC -O"
  137. fi
  138. rm -f conftest*
  139.  
  140. echo checking how to run the C preprocessor
  141. if test -z "$CPP"; then
  142.   CPP='${CC-cc} -E'
  143.   cat <<EOF > conftest.c
  144. $DEFS
  145. #include <stdio.h>
  146. EOF
  147. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  148. if test -z "$err"; then
  149.   :
  150. else
  151.   CPP=/lib/cpp
  152. fi
  153. rm -f conftest*
  154. fi
  155.  
  156. # Make sure to not get the incompatible SysV /etc/install and
  157. # /usr/sbin/install, which might be in PATH before a BSD-like install,
  158. # or the SunOS /usr/etc/install directory.
  159. if test -z "$INSTALL"; then
  160.   echo checking for install
  161.   saveifs="$IFS"; IFS="${IFS}:"
  162.   for dir in $PATH; do
  163.     test -z "$dir" && dir=.
  164.     case $dir in
  165.     /etc|/usr/sbin|/usr/etc) ;;
  166.     *)
  167.       if test -f $dir/install; then
  168.     INSTALL="$dir/install -c"
  169.     INSTALL_PROGRAM='$(INSTALL)'
  170.     INSTALL_DATA='$(INSTALL) -m 644'
  171.     break
  172.       fi
  173.       ;;
  174.     esac
  175.   done
  176.   IFS="$saveifs"
  177. fi
  178. INSTALL=${INSTALL-cp}
  179. INSTALL_PROGRAM=${INSTALL_PROGRAM-'$(INSTALL)'}
  180. INSTALL_DATA=${INSTALL_DATA-'$(INSTALL)'}
  181.  
  182. echo checking for AIX
  183. cat <<EOF > conftest.c
  184. $DEFS
  185. #ifdef _AIX
  186.   yes
  187. #endif
  188.  
  189. EOF
  190. eval "$CPP conftest.c > conftest.out 2>&1"
  191. if egrep "yes" conftest.out >/dev/null 2>&1; then
  192.   DEFS="${DEFS}#define _ALL_SOURCE 1
  193. "
  194. fi
  195. rm -f conftest*
  196.  
  197.  
  198. echo checking for minix/config.h
  199. cat <<EOF > conftest.c
  200. $DEFS
  201. #include <minix/config.h>
  202. EOF
  203. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  204. if test -z "$err"; then
  205.   MINIX=1
  206. fi
  207. rm -f conftest*
  208.  
  209. # The Minix shell can't assign to the same variable on the same line!
  210. if test -n "$MINIX"; then
  211.   DEFS="${DEFS}#define _POSIX_SOURCE 1
  212. "
  213.   DEFS="${DEFS}#define _POSIX_1_SOURCE 2
  214. "
  215.   DEFS="${DEFS}#define _MINIX 1
  216. "
  217. fi
  218.  
  219. echo checking for POSIXized ISC
  220. if test -d /etc/conf/kconfig.d &&
  221.   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
  222. then
  223.   ISC=1 # If later tests want to check for ISC.
  224.   DEFS="${DEFS}#define _POSIX_SOURCE 1
  225. "
  226.   if test -n "$GCC"; then
  227.     CC="$CC -posix"
  228.   else
  229.     CC="$CC -Xp"
  230.   fi
  231. fi
  232.  
  233. echo checking for directory library header
  234. echo checking for dirent.h
  235. cat <<EOF > conftest.c
  236. $DEFS
  237. #include <dirent.h>
  238. EOF
  239. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  240. if test -z "$err"; then
  241.   DEFS="${DEFS}#define DIRENT 1
  242. " dirheader=dirent.h
  243. fi
  244. rm -f conftest*
  245.  
  246. if test -z "$dirheader"; then
  247. echo checking for sys/ndir.h
  248. cat <<EOF > conftest.c
  249. $DEFS
  250. #include <sys/ndir.h>
  251. EOF
  252. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  253. if test -z "$err"; then
  254.   DEFS="${DEFS}#define SYSNDIR 1
  255. " dirheader=sys/ndir.h
  256. fi
  257. rm -f conftest*
  258.  
  259. fi
  260. if test -z "$dirheader"; then
  261. echo checking for sys/dir.h
  262. cat <<EOF > conftest.c
  263. $DEFS
  264. #include <sys/dir.h>
  265. EOF
  266. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  267. if test -z "$err"; then
  268.   DEFS="${DEFS}#define SYSDIR 1
  269. " dirheader=sys/dir.h
  270. fi
  271. rm -f conftest*
  272.  
  273. fi
  274.  
  275. echo checking for closedir return value
  276. cat <<EOF > conftest.c
  277. #include <sys/types.h>
  278. #include <$dirheader>
  279. int closedir(); main() { exit(0); }
  280. EOF
  281. eval $compile
  282. if test -s conftest && (./conftest; exit) 2>/dev/null; then
  283.   :
  284. else
  285.   DEFS="${DEFS}#define VOID_CLOSEDIR 1
  286. "
  287. fi
  288. rm -f conftest*
  289.  
  290. if test -z "$dirheader"; then
  291.   DEFS="${DEFS}#define NODIR 1
  292. "
  293. fi
  294. echo checking return type of signal handlers
  295. echo "${DEFS}#include <signal.h>" > conftest.c
  296. eval "$CPP conftest.c > conftest.out 2>&1"
  297. if egrep "(void|sighandler_t).*signal" conftest.out >/dev/null 2>&1; then
  298.   :
  299. else 
  300.   DEFS="${DEFS}#define RETSIGTYPE int
  301. "
  302. fi
  303. rm -f conftest*
  304.  
  305.  
  306. echo checking for ANSI C header files
  307. cat <<EOF > conftest.c
  308. $DEFS
  309. #include <stdlib.h>
  310. #include <stdarg.h>
  311. #include <string.h>
  312. #include <limits.h>
  313. EOF
  314. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  315. if test -z "$err"; then
  316.   DEFS="${DEFS}#define STDC_HEADERS 1
  317. "
  318. fi
  319. rm -f conftest*
  320.  
  321. echo checking for unistd.h
  322. cat <<EOF > conftest.c
  323. $DEFS
  324. #include <unistd.h>
  325. EOF
  326. err=`eval "$CPP conftest.c 2>&1 >/dev/null"`
  327. if test -z "$err"; then
  328.   DEFS="${DEFS}#define HAVE_UNISTD_H 1
  329. "
  330. fi
  331. rm -f conftest*
  332.  
  333. echo checking for BSD string and memory functions
  334. echo "#include <strings.h>
  335. main() { exit(0); } t() { rindex(0, 0); bzero(0, 0); }" > conftest.c
  336. if eval $compile; then
  337.   :
  338. else
  339.   DEFS="${DEFS}#define USG 1
  340. "
  341. fi
  342. rm -f conftest*
  343.  
  344. for func in rename
  345. do
  346. echo checking for ${func}
  347. echo "
  348. main() { exit(0); } t() { 
  349. /* Override any gcc2 internal prototype to avoid an error.  */
  350. extern char ${func}(); ${func}(); }" > conftest.c
  351. if eval $compile; then
  352.   :
  353. else
  354.   LIBOBJS="$LIBOBJS ${func}.o"
  355. fi
  356. rm -f conftest*
  357.  
  358. done
  359.  
  360. for func in strerror
  361. do
  362. trfrom='[a-z]' trto='[A-Z]'
  363. echo checking for ${func}
  364. echo "
  365. main() { exit(0); } t() { 
  366. /* Override any gcc2 internal prototype to avoid an error.  */
  367. extern char ${func}(); ${func}(); }" > conftest.c
  368. if eval $compile; then
  369.   DEFS="${DEFS}#define HAVE_`echo $func|tr "$trfrom" "$trto"` 1
  370. "
  371. fi
  372. rm -f conftest*
  373. done
  374.  
  375. # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
  376. # for constant arguments.  Useless!
  377. echo checking for working alloca.h
  378. echo "#include <alloca.h>
  379. main() { exit(0); } t() { char *p = alloca(2 * sizeof(int)); }" > conftest.c
  380. if eval $compile; then
  381.   DEFS="${DEFS}#define HAVE_ALLOCA_H 1
  382. "
  383. fi
  384. rm -f conftest*
  385.  
  386. decl="#ifdef __GNUC__
  387. #define alloca __builtin_alloca
  388. #else
  389. #if HAVE_ALLOCA_H
  390. #include <alloca.h>
  391. #else
  392. #ifdef _AIX
  393.  #pragma alloca
  394. #else
  395. char *alloca ();
  396. #endif
  397. #endif
  398. #endif
  399. "
  400. echo checking for alloca
  401. echo "$decl
  402. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  403. if eval $compile; then
  404.   :
  405. else
  406.   alloca_missing=1
  407. fi
  408. rm -f conftest*
  409.  
  410. if test -n "$alloca_missing"; then
  411.   SAVELIBS="$LIBS"
  412.   # Maybe alloca is in a different library.
  413.   #if test -f /usr/ucblib/libucb.a; then
  414.     # Avoid the broken BSD compatibility library as much as possible.
  415.     #LIBS="$LIBS -L/usr/ucblib -lc -lucb" trylib=-lucb # SVR4
  416.   #el
  417.   if test -f /lib/libPW.a; then
  418.     LIBS="$LIBS -lPW" trylib=-lPW # SVR2 and SVR3
  419.   fi
  420.   if test -n "$trylib"; then
  421.     alloca_missing=
  422.     echo checking for alloca in $trylib
  423. echo "$decl
  424. main() { exit(0); } t() { char *p = (char *) alloca(1); }" > conftest.c
  425. if eval $compile; then
  426.   :
  427. else
  428.   alloca_missing=1
  429. fi
  430. rm -f conftest*
  431.  
  432.   fi
  433.   if test -n "$alloca_missing"; then
  434.     LIBS="$SAVELIBS" ALLOCA=alloca.o
  435.   fi
  436. fi
  437.  
  438. echo checking for long file names
  439. (echo 1 > conftest9012345) 2>/dev/null
  440. (echo 2 > conftest9012346) 2>/dev/null
  441. val=`cat conftest9012345 2>/dev/null`
  442. test -f conftest9012345 && test "$val" = 1 && DEFS="${DEFS}#define HAVE_LONG_FILE_NAMES 1
  443. "
  444. rm -f conftest9012345 conftest9012346
  445.  
  446. echo checking for Xenix
  447. cat <<EOF > conftest.c
  448. $DEFS
  449. #if defined(M_XENIX) && !defined(M_UNIX)
  450.   yes
  451. #endif
  452.  
  453. EOF
  454. eval "$CPP conftest.c > conftest.out 2>&1"
  455. if egrep "yes" conftest.out >/dev/null 2>&1; then
  456.   XENIX=1
  457. fi
  458. rm -f conftest*
  459.  
  460. if test -n "$XENIX"; then
  461.   DEFS="${DEFS}#define VOID_CLOSEDIR 1
  462. "
  463.   LIBS="$LIBS -lx"
  464.   case "$DEFS" in
  465.   *SYSNDIR*) ;;
  466.   *) LIBS="-ldir $LIBS" ;; # Make sure -ldir precedes any -lx.
  467.   esac
  468. fi
  469.  
  470. if test -n "$prefix"; then
  471.   test -z "$exec_prefix" && exec_prefix='$(prefix)'
  472.   prsub="s,^prefix[     ]*=.*$,prefix = $prefix,"
  473. fi
  474. if test -n "$exec_prefix"; then
  475.   prsub="$prsub
  476. s,^exec_prefix[     ]*=.*$,exec_prefix = $exec_prefix,"
  477. fi
  478.  
  479. trap 'rm -f config.status; exit 1' 1 3 15
  480. echo creating config.status
  481. rm -f config.status
  482. cat <<EOF > config.status
  483. #!/bin/sh
  484. # Generated automatically by configure.
  485. # Run this file to recreate the current configuration.
  486. # This directory was configured as follows,
  487. # on host `(hostname || uname -n) 2>/dev/null`:
  488. #
  489. # $0 $*
  490.  
  491. case "\$1" in
  492.   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  493.   exec /bin/sh $0 $* ;;
  494. esac
  495.  
  496. trap 'rm -f Makefile config.h; exit 1' 1 3 15
  497. CC='$CC'
  498. CPP='$CPP'
  499. INSTALL='$INSTALL'
  500. INSTALL_PROGRAM='$INSTALL_PROGRAM'
  501. INSTALL_DATA='$INSTALL_DATA'
  502. LIBOBJS='$LIBOBJS'
  503. ALLOCA='$ALLOCA'
  504. LIBS='$LIBS'
  505. srcdir='$srcdir'
  506. DEFS='$DEFS'
  507. prefix='$prefix'
  508. exec_prefix='$exec_prefix'
  509. prsub='$prsub'
  510. EOF
  511. cat <<\EOF >> config.status
  512.  
  513. top_srcdir=$srcdir
  514. for file in Makefile; do
  515.   srcdir=$top_srcdir
  516.   # Remove last slash and all that follows it.  Not all systems have dirname.
  517.   dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  518.   if test "$dir" != "$file"; then
  519.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  520.     test ! -d $dir && mkdir $dir
  521.   fi
  522.   echo creating $file
  523.   rm -f $file
  524.   echo "# Generated automatically from `basename $file`.in by configure." > $file
  525.   sed -e "
  526. $prsub
  527. s,@CC@,$CC,g
  528. s,@CPP@,$CPP,g
  529. s,@INSTALL@,$INSTALL,g
  530. s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
  531. s,@INSTALL_DATA@,$INSTALL_DATA,g
  532. s,@LIBOBJS@,$LIBOBJS,g
  533. s,@ALLOCA@,$ALLOCA,g
  534. s,@LIBS@,$LIBS,g
  535. s,@srcdir@,$srcdir,g
  536. " $top_srcdir/${file}.in >> $file
  537. done
  538.  
  539. echo creating config.h
  540. # Ultrix awk loses trailing comments from the header file, but
  541. # that's not fatal.
  542. rm -f conftest.h
  543. echo "/* config.h.  Generated automatically by configure.  */" > conftest.h
  544. echo "$DEFS
  545. /* END_OF_DEFS */" |
  546. awk '
  547. # The escaped newlines are to work around a bug in GNU m4 0.99
  548. # in quoting more than 2 arguments in a single line.
  549. BEGIN { filenum = 1 }
  550. filenum == 1 && $1 == "#define" \
  551. { defs[$2] = $3
  552.   defined[$2] = 1
  553.   for (i = 4; i <= NF; i++)
  554.     defs[$2] = defs[$2] " " $i
  555. }
  556. /END_OF_DEFS/ { filenum = 2; next }
  557. filenum == 2 && $1 == "#define" && \
  558. defined[$2] == 1 {
  559.   $3 = defs[$2]
  560.   print; next
  561. }
  562. filenum == 2 && $1 == "#undef" && \
  563. defined[$2] == 1 {
  564.   $1 = "#define"
  565.   $2 = $2 " " defs[$2]
  566.   print; next
  567. }
  568. filenum == 2 { print }
  569. ' - $top_srcdir/config.h.in >> conftest.h
  570. if cmp -s config.h conftest.h 2>/dev/null; then
  571.   # The file exists and we would not be changing it.
  572.   rm -f conftest.h
  573. else
  574.   rm -f config.h
  575.   mv conftest.h config.h
  576. fi
  577.  
  578. EOF
  579. chmod +x config.status
  580. test -n "$no_create" || ./config.status
  581.  
  582.